package com.unitedvision.web;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.unitedvision.persistence.domain.CustomerEntity;
import com.unitedvision.service.CustomerService;

@Controller
public class CustomerController {
	@Autowired
	private CustomerService customerService;
	
	@RequestMapping ("/apps/customer")
	public String showHomePage(Map<String, Object> model) {
		List<CustomerEntity> list = customerService.getAll();
		if ((list == null) || (list.size() <= 0)) {
			model.put("message", "No Customer Found");
		} else {
			model.put("message", "there are " + list.size() + "customer(s)");
		}
		
		return "customer";
	}
}
